Skip to content

Allow 64bit ints for TTL in client. - #13

Merged
appkins merged 1 commit into
cpp-redis:masterfrom
dgpetrie:master
Mar 30, 2019
Merged

appkins merged 1 commit into
cpp-redis:masterfrom
dgpetrie:master

Conversation

@dgpetrie

Copy link
Copy Markdown

Redis server supports 64 bit ints for TTL.
Actually up to 0x7FFFFFFFFFFFFFFFLL milliseconds.
Or 0x7FFFFFFFFFFFFFFFLL/1000 seconds.

  Redis server supports 64 bit ints for TTL.
  Actually up to 0x7FFFFFFFFFFFFFFFLL milliseconds.
  Or 0x7FFFFFFFFFFFFFFFLL/1000 seconds.
@appkins

appkins commented Mar 18, 2019

Copy link
Copy Markdown

This commit stumps me. I'd like to support 64 bit ints, but don't want to create compatibility issues. I'm tempted to create an alias with pre-compiler support for int/int64 with a 64 bit default, but don't want to hinder cross compatibility with other libraries by introducing an int_t type.

We could namespace the int_t, but it is common for developers to include the cpp_redis namespace which could complicate implementation.

@dgpetrie

Copy link
Copy Markdown
Author

Hi:
Thank you for looking at this!

Help me understand the compablity issue. Won't most compliers allow a 32 bit int to be passed where the argument type is a 64 bit int? I think the worst case is a warning isn't it? Or is your concern that there are C++ platforms that don't support 64 bit ints?

We could create a typedef for TTL.

Cheers,
Dan

@appkins

appkins commented Mar 30, 2019 •

Copy link
Copy Markdown

I've looked into this further and believe it will be fine. Worst case scenario is it will negatively impact performance on 32 bit systems if they do not first cast to 32 bit. I would prefer to avoid unnecessary typedefs if they can be avoided, so for now I'll just go ahead and merge the changes.

Thanks for the contribution! If you plan on contributing further, I'm happy to add you to the team for the project. I'd also like to get a contributor list going in the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants